package com.jt.springboot_demo1.Controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
//注解的规则:如果注解中只有一个属性,并且名称为valve时,则属性名称可以省略
//注解的规则:如果注解中如果有多个属性,属性名称不可以省略
@PropertySource(value = "classpath:/data.properties",encoding = "utf-8")//看到source 就+classpath
public class HelloController {
    @Value("${userinfo.name}")
    private String name,age;

    @Value("${user.infoname2}")
    private String infoname2;

    @RequestMapping("/hi")
    public void hi(){
        System.out.println("欢迎使用springboot"+name+age);
        System.out.println(infoname2);
    }
}
